package com.module.overview.ui.schedule.provider

import android.view.View
import android.widget.TextView
import com.chad.library.adapter.base.provider.BaseItemProvider
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.common.app.core.RouterHub
import com.common.app.data.bean.KeyBundle
import com.common.app.data.bean.overView.CardSettingModel
import com.common.app.helper.RouterHelper
import com.common.base.app.extras.setSafeOnClickListener
import com.common.base.app.extras.setVisible
import com.common.base.utils.AppUtils.getString
import com.module.ble.utils.AllCardTypeConfig
import com.module.overview.R

/**
 *
 * 作者：sosou
 *
 * 版本：1.0
 *
 * 创建日期：2025/6/16
 *
 * 描述：经期管理卡片
 *
 * 修订历史：
 *
 */
class OvMainPeriodCardProvider(
    override val itemViewType: Int = AllCardTypeConfig.TYPE_CARD_PERIOD,
    override val layoutId: Int = R.layout.overview_main_period_crad_provider
) : BaseItemProvider<CardSettingModel>() {


    init {
    }

    override fun convert(helper: BaseViewHolder, item: CardSettingModel) {
        helper.getView<View>(R.id.totalPeriodCard).setSafeOnClickListener {
            RouterHelper.navigationPostcard(RouterHub.ROUTER_OVERVIEW_CARD_HISTORY_DETAILS)
                .withString(KeyBundle.BUNDLE_TITLE, item.name)
                .navigation()
        }
        helper.itemView.setVisible(item.isEnabled)

        helper.getView<TextView>(R.id.tvPeriodWhichDay).text = getString(R.string.common_which_day_split,getString(R.string.common_rail_unit))
    }

    override fun onViewHolderCreated(viewHolder: BaseViewHolder, viewType: Int) {
        super.onViewHolderCreated(viewHolder, viewType)
    }

    override fun onViewDetachedFromWindow(holder: BaseViewHolder) {
        super.onViewDetachedFromWindow(holder)
    }

}